package io.renren.modules.canteens.dao;

import io.renren.common.dao.BaseDao;
import io.renren.modules.canteens.dto.BatchOrderDTO;
import io.renren.modules.canteens.dto.BatchOrdermxDTO;
import io.renren.modules.canteens.entity.BatchOrderEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 批量采购表
 *
* @author 翟文闯 619556390@QQ.com
 * @since 1.0.0 2020-01-03
 */
@Mapper
public interface BatchOrderDao extends BaseDao<BatchOrderEntity> {

    @Select("SELECT  sum(B.unit_price*B.purchase_num) as tatolMoney,A.*  FROM canteens_batch_order A, canteens_batch_ordermx B where A.batch_order_id = b.batch_order_id  and A.batch_order_id = '${batchOrderId}'  ")
    BatchOrderDTO getTotalMoney(Long batchOrderId);
    @Select("SELECT B.* FROM canteens_batch_order A , canteens_batch_ordermx B where B.batch_order_id = A.batch_order_id and " +
            " A.batch_order_id= ${batchOrderId}  order by A.create_date ")
    List<BatchOrdermxDTO>getOrdermx(Long batchOrderId);
}